<template>
  <div class="kv" v-show="this.isShow.isKVShow">
    <div class="container">
      <div class="logo"></div>
      <div class="title">
        <div class="ball animatedBall bounceInRight"></div>
        <div class="title2 animatedTitle2 bounceInLeft"></div>
        <div class="title1 animated bounceInLeft"></div>
        <div class="title3 animatedTitle3 bounceInRight"></div>
      </div>
      <div class="buttons">
        <div class="btn-main" @click="nextToPP">
          <div class="btn-bg">
            <div class="btn-w"></div>
          </div>
        </div>
        <div class="details" @click="getDetail">活动规则</div>
      </div>
      <transition name="fade">
        <div class="mask" v-show="showDetail">
          <div class="mask-container">
            <div class="mask-title"></div>
            <div class="mask-content">
              <p class="mask-word" v-for="item in myData" :key="item.key">
                {{item.val}}
              </p>
            </div>
            <div class="over-btn" @click="hideDetail"></div>
          </div>
        </div>
      </transition>
    </div>
  </div>
</template>

<script>
import { myData } from './myData.js';

export default {
  name: 'pageKV',
  props: {
    isShow: {
      type: Object
    }
  },
  data () {
    return {
      showDetail: false,
      myData
    }
  },
  methods: {
    nextToPP () {
      this.$emit('toPP')
    },
    getDetail () {
      this.showDetail = true
    },
    hideDetail () {
      this.showDetail = false
    }
  }
}
</script>

<style lang="less" scoped>
.kv {
  width: 100%;
  height: 100%;
  background-image: url('./kv_lawn.jpg');
  background-size: 100% auto;
  .container {
    position: relative;
    width: 100%;
    height: 100%;
    background-image: url('./kv_bg.jpg');
    background-size: 100% 100%;
    .logo {
      position: absolute;
      left: 50%;
      top: 2vh;
      transform: translateX(-4.890625rem /* 78.25/16 */);
      width: 9.78125rem /* 156.5/16 */;
      height: .96875rem /* 15.5/16 */;
      background-image: url('./kv_logo.png');
      background-size: 100% 100%;
    }
    .title {
      position: absolute;
      top: 7.63vh;
      width: 100%;
      height: 18.9375rem /* 303/16 */;
      .ball {
        position: absolute;
        right: 0;
        width: 19.75rem /* 316/16 */;
        height: 13.96875rem /* 223.5/16 */;
        background-image: url('./kv_title-ball.png');
        background-size: 100% 100%;
      }
      .title1 {
        position: absolute;
        left: 0;
        width: 20.84375rem /* 333.5/16 */;
        height: 10.15625rem /* 162.5/16 */;
        margin-top: 2.4rem;
        background-image: url('./kv_title-best.png');
        background-size: 100% 100%;
      }
      .title2 {
        position: absolute;
        width: 100%;
        height: 13.78125rem /* 220.5/16 */;
        margin-top: 6rem;
        background-image: url('./kv_title-battle.png');
        background-size: 100% 100%;
      }
      .title3 {
        position: absolute;
        right: 0;
        bottom: 0;
        width: 18.78125rem /* 300.5/16 */;
        height: 5.3125rem /* 85/16 */;
        background-image: url('./kv_title-bottom.png');
        background-size: 100% 100%;
      }
    }
    .buttons {
      position: absolute;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      left: 50%;
      transform: translateX(-4rem);
      bottom: 2vh;
      height: 10.75rem /* 172/16 */;
      width: 8rem /* 128/16 */;
      .btn-main {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 8rem;
        height: 8rem;
        background-color: rgba(0, 0, 0, .32);
        border-radius: 50%;
        .btn-bg {
          display: flex;
          justify-content: center;
          align-items: center;
          width: 6.875rem /* 110/16 */;
          height: 6.875rem /* 110/16 */;
          background-color: rgba(255, 255, 255, .5);
          border-radius: 50%;
          .btn-w {
            width: 4.0625rem /* 65/16 */;
            height: 4.90625rem /* 78.5/16 */;
            background-image: url('./kv_start.png');
            background-size: 100% 100%;
          }
        }
      }
      .details {
        color: #eee;
        letter-spacing: .2rem;
        font-weight: 700;
        line-height: 1.8;
        border-bottom: 1px solid #eee;
      }
    }
    .mask {
      position: relative;
      width: 100%;
      height: 100%;
      z-index: 5;
      background-color: rgba(0,0,0,0.8);
      .mask-container {
        position: absolute;
        top: 10%;
        left: 50%;
        transform: translateX(-10.0625rem /* 161/16 */);
        width: 20.125rem /* 322/16 */;
        height: 32.03125rem /* 512.5/16 */;
        background-color: #eee;
        border-radius: .8rem;
        .mask-title {
          position: absolute;
          left: 50%;
          transform: translateX(-4.5625rem /* 73/16 */);
          margin-top: -0.4rem;
          width: 9.125rem /* 146/16 */;
          height: 2.96875rem /* 47.5/16 */;
          background-image: url('./kv_header.png');
          background-size: 100% 100%;
        }
        .mask-content {
          box-sizing: border-box;
          margin: 20% 11%;
          font-size: .75rem /* 12/16 */;
          line-height: 1.4;
          height: 22.5rem /* 360/16 */;
          color: #333;
          overflow: scroll;
          box-shadow: inset 0 -1px 0px 0px rgba(0,0,0,0.25);
          .mask-word {
            letter-spacing: .12rem;
            margin-bottom: .8rem;
          }
        }
        .over-btn {
          position: absolute;
          bottom: 5%;
          left: 50%;
          transform: translateX(-5.15625rem /* 82.5/16 */);
          width: 10.3125rem /* 165/16 */;
          height: 2.375rem /* 38/16 */;
          background-image: url(./kv_btn-detail.png);
          background-size: 100% 100%;
        }
        .mask-content::-webkit-scrollbar {
          display: none;
        }
      }
    }
  }
}
.fade-enter-active, .fade-leave-active {
  transition: opacity .2s;
}
.fade-enter, .fade-leave-to {
  opacity: 0;
}

.animatedTitle2 {
  animation-delay: .5s;
  animation-duration: 1s;
  animation-fill-mode: both;
}

.animatedTitle3 {
  animation-delay: 1s;
  animation-duration: 1s;
  animation-fill-mode: both;
}

.animatedBall {
  animation-delay: 1.5s;
  animation-duration: 1s;
  animation-fill-mode: both;
}

.animated {
  animation-duration: 1s;
  animation-fill-mode: both;
}

.bounceInLeft {
  animation-name: bounceInLeft;
}

.bounceInRight {
  animation-name: bounceInRight;
}

@keyframes bounceInLeft {
  from,
  60%,
  75%,
  90%,
  to {
    -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }

  0% {
    opacity: 0;
    -webkit-transform: translate3d(-3000px, 0, 0);
    transform: translate3d(-3000px, 0, 0);
  }

  60% {
    opacity: 1;
    -webkit-transform: translate3d(25px, 0, 0);
    transform: translate3d(25px, 0, 0);
  }

  75% {
    -webkit-transform: translate3d(-10px, 0, 0);
    transform: translate3d(-10px, 0, 0);
  }

  90% {
    -webkit-transform: translate3d(5px, 0, 0);
    transform: translate3d(5px, 0, 0);
  }

  to {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
}

@keyframes bounceInRight {
  from,
  60%,
  75%,
  90%,
  to {
    -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }

  from {
    opacity: 0;
    -webkit-transform: translate3d(3000px, 0, 0);
    transform: translate3d(3000px, 0, 0);
  }

  60% {
    opacity: 1;
    -webkit-transform: translate3d(-25px, 0, 0);
    transform: translate3d(-25px, 0, 0);
  }

  75% {
    -webkit-transform: translate3d(10px, 0, 0);
    transform: translate3d(10px, 0, 0);
  }

  90% {
    -webkit-transform: translate3d(-5px, 0, 0);
    transform: translate3d(-5px, 0, 0);
  }

  to {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
}
</style>
